import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../dd_module/dd_home/pages/dd_home_page.dart';
import '../dd_module/dd_launch_and_main/pages/dd_guide_page.dart';
import '../dd_module/dd_launch_and_main/pages/dd_login_page.dart';
import '../dd_module/dd_launch_and_main/pages/dd_main_tab_page.dart';
import '../dd_module/dd_launch_and_main/pages/dd_splash_page.dart';


class DDRoutesConfig {
  static const main = '/main';
  static const splash = '/splash';
  static const guide = '/guide';
  static const login = '/login';
  static const home ='/home';


  static final Map<String, WidgetBuilder> routes = {
    main: (context) => DDMainTabPage(),
    splash: (context)=> DDSplashPage(),
    guide: (context) => DDGuidePage(),
    login: (context) => DDLoginPage(),
    home: (context) => DDHomePage(),
  };

  static Future<T?>? push<T>(Widget page,
      {String? routeName, bool fullscreenDialog = false}) {
    return navigator?.push<T>(MaterialPageRoute(
      fullscreenDialog: fullscreenDialog,
      settings: RouteSettings(name: routeName ?? getDefaultRouteName(page)),
      builder: (context) {
        return page;
      },
    ));
  }

  static String getDefaultRouteName(Widget page) {
    return "/${page.runtimeType.toString()}";
  }
}

class DDKey {
  static const String spKeyUserFirstUse = 'user_first_use';
  static const String cureenUid = 'cureen_uid';
  static const String autoTranslate = 'auto_translate';
}


class DDScreenUtil {
  static double getWidthRatio() {
    return Get.width / 375.0;
  }
  static double getHeightRatio() {
    return Get.height / 812.0;;
  }
}
